<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <title><#if entity.aftersalesId??>编辑<#else>新增</#if>售后服务</title>
    <#include "/view/admin/head.html"/>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />


    <script type="text/javascript" src="${base}/jstool/bootstrap-validator-0.5.3/js/bootstrapValidator.min.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-validator-0.5.3/lang/zh_CN.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-validator-0.5.3/css/bootstrapValidator.min.css" />


    <style type="text/css">
        .list-path {
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;
        }

        .table-class {
            width: 90%;
            text-align: center;
            border: 1px solid #afd9ee;
            margin: 0 auto;
            margin-top: 50px;
        }

        table th {
            width: 20%;
            background-color: #d9edf7;
            text-align: right;
        }

        table td {
            width: 20%;
            text-align: left;
        }


    </style>
    <script type="text/javascript">

        $(function(){
            //初始化





                $('#createtime').datetimepicker({language: 'zh-CN' });
                $('#updatetime').datetimepicker({language: 'zh-CN' });



            $('#czjaftersalesForm').bootstrapValidator({
                message: 'This value is not valid',
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {



                    
             /*   commodityId:{
                    message: '输入商品出错',
                    validators:{
                        notEmpty: {
                            message: '商品不能为空'
                        },
                        stringLength:{
                            max: 19,
                            message: '商品不能超过 19个字符'
                        }
                    }
                }

                    ,*/
                name:{
                    message: '输入售后服务名称出错',
                    validators:{
                        notEmpty: {
                            message: '售后服务名称不能为空'
                        },
                        stringLength:{
                            max: 19,
                            message: '售后服务名称不能超过 19个字符'
                        }
                    }
                }

                    ,
                value:{
                    message: '输入售后服务内容出错',
                    validators:{
                        notEmpty: {
                            message: '售后服务内容不能为空'
                        },
                        stringLength:{
                            max: 255,
                            message: '售后服务内容不能超过 255个字符'
                        }
                    }
                }

                    ,
                orderByno:{
                    message: '输入排序出错',
                    validators:{
                        notEmpty: {
                            message: '排序不能为空'
                        },
                        stringLength:{
                            max: 2,
                            message: '排序不能超过 2个字符'
                        },
                        regexp: {
                            regexp: /^[0-9]+$/,
                                    message:'排序只能是数字'
                        }
                    }
                }




                }
            });


        });

    </script>
</head>
<body>

<div class="list-path">
		<span style="margin-left: 50px;"> 
                <span
                class="glyphicon glyphicon-home"></span> 售后服务列表 / <#if entity.aftersalesId??>编辑<#else>新增</#if>售后服务
		</span>

</div>


<div class="table-class">
    <#include "/view/admin/opermsg.html"/>
    <form id="czjaftersalesForm" action="${base}/busin/czjaftersalesSave"
     >
    <table class="table table-bordered">

                        <input type="hidden" style="display: none" name="aftersalesId" value="${entity.aftersalesId!}"/>


                <tr hidden>
                <th>商品</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="commodityId" name="commodityId" placeholder="请输入商品" value="${commodityId!}">
                    </div>
                </td>
                

                </tr>
        <tr>
                <th>售后服务名称</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="name" name="name" placeholder="请输入售后服务名称" value="${entity.name!}">
                    </div>
                </td>
                </tr>

                <tr>
                <th>售后服务内容</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="value" name="value" placeholder="请输入售后服务内容" value="${entity.value!}">
                    </div>
                </td>
                </tr>
        <tr>

                
                <th>排序</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="orderByno" name="orderByno" placeholder="请输入排序" value="${entity.orderByno!}">
                    </div>
                </td>
                </tr>


        <tr>
            <td colspan="2" width="100%" style="text-align: center;">
            <input type="button" class="btn btn-success"  onclick="btn_submit()" value="保存"/>
                 <!--  <span style="width: 20px;">&nbsp;</span>
              <a class="btn btn-danger " href="javascript:window.history.go(-1)">
                   </span>返回</a> -->
            </td>
        </tr>

    </table>
</form>




</div>

<script type="text/javascript">
function btn_submit(){
	
	var commodityId=$("input[name='commodityId']").val(); 
		$
		.ajax( {
			url : "${base}/busin/czjaftersalesSave",
			data:$('#czjaftersalesForm').serialize(),
			dataType : "json",
			type : "POST",
			success : function(data) {
				
				if(data.status==0){
					layer.alert("提交失败，请重新提交");
				}else{
				parent.window.location.reload();
		         var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		         parent.layer.close(index);
				}
			},
			error : function() {
				alert('系统繁忙');
			}

		});
		
		
	
}

</script>


</body>
</html>
